home *** CD-ROM | disk | FTP | other *** search
/ Floppyshop 2 / Floppyshop - 2.zip / Floppyshop - 2.iso / art&graf.ix / art-0054 / cv2img09 / conv2img.txt < prev   
Text File  |  1997-04-16  |  9KB  |  204 lines

  1.         Convert to .IMG by Craig W. Daymon
  2.         ======= == ==== == ===== == ======
  3.  
  4.     ***   This program is Public Domain   ***
  5.  
  6.         Copyright, 1989 - Craig W. Daymon
  7.  
  8.     This is the first release of this program and not all features
  9. are active.  There are enough that I thought I would send this one
  10. out to get some response.
  11.  
  12. **********************************************************************
  13.  
  14.    THIS IS VERSION 0.9 - PLEASE DISTRIBUTE THIS TEXT WITH THE PROGRAM
  15.  
  16. **********************************************************************
  17.  
  18.     The program will convert the six DEGAS formats, Neochrome, Spectrum
  19. compressed and uncompressed, Mac Paint and Tiny to a monochrome 
  20. .IMG format file.  These file should be compatible with any programs that
  21. are able to use .IMG files.  They have been tested with the .IMG viewer
  22. from Migraph, IMG Quick View, WordUp, PageStream and Easy-Draw as well as
  23. a program I wrote to use the GEM function,v_bit_image(), to print 
  24. .IMG files with the help of GDOS. (G+Plus)
  25.  
  26.  
  27. PROGRAM OPERATION:
  28. ======= =========
  29.  
  30.  
  31.     The first thing to be displayed is the main selection dialog.  From
  32. here you can "click-on" the desired picture format you wish to convert.
  33. You may also exit the program from this dialog.
  34.  
  35.     After selecting a format to convert, the file selector will appear
  36. to allow you to select a file.  Selecting 'CANCEL' in the selector will
  37. return you to the dialog.  *Make sure to select a file of the same type you
  38. chose from the dialog.  (The wildcard in the selector will indicate the
  39. type selected in the dialog.)
  40.  
  41.     When a file has been selected, the dialog will change to indicate that
  42. the conversion has begun and the file will be loaded by the program.
  43.  
  44.     If you are using a monochrome monitor, once the file is loaded the
  45. screen will switch to show the conversion buffer (for color images only)
  46. and you can watch as the image is drawn on the screen.  (This worked in
  47. version 0.5.  My mono monitor has since died, so let me know if there
  48. are any problems with this feature.)
  49.  
  50.     If you are using a color monitor, the dialog will remain displayed.
  51.  
  52.     When the conversion is finished, the file selector will again appear
  53. and you can choose a name and directory for the converted image.  If you
  54. decide not to save the image, you can safely CANCEL and the image will
  55. not be saved.
  56.  
  57.     After saving the image, the main dialog is again displayed to allow
  58. the conversion of another file.
  59.  
  60.  
  61. PLEASE SEND COMMENTS:
  62. ====== ==== ========
  63.  
  64.     If there is something you would like to see added tothis program,
  65. send me a message through GEnie.  My address on GEnie is: C.DAYMON.
  66. If you have any information on any paint formats you would like to see
  67. added or detailed information on formats already supported, please get
  68. in touch with me.  (Not all the information I have is accurate and I have
  69. had to make an educated guess or two.)  I am especially looking for
  70. information on IFF, Mac (all formats including those for the Mac II) and
  71. Art Director.
  72.  
  73.  
  74. The IMG file format (a brief description)
  75. === === ==== ====== =====================
  76.  
  77.     The first part of any .IMG file is the header.  (Sounds reasonable.)
  78. Each item in the header is a 16-bit word.
  79.  
  80. The format is:
  81.  
  82.     Word    |   Contents
  83. =============================================================================
  84.      0      |   IMG version number.  ( 0x0001 works best, believe me. )
  85.      1      |   Header length in words.  ( IMPORTANT to check when reading. )
  86.      2      |   Number of bit planes. ( Also IMPORTANT.  1 = Monochrome. )
  87.      3      |   Pattern length.     ( Part of data compression, usually 2. )
  88.      4      |   Source device pixel width in microns. (25,400 microns/inch)
  89.      5      |   Source device pixel height in microns.
  90.      6      |   Number of pixels per scan line.
  91.      7      |   Number of scan lines.
  92.  
  93. Notes:
  94. =====
  95.  
  96.     1)  I use a value of 8 for the header length as do most of the
  97.         monochrome images available.  (No extra information.)
  98.     2)  The number of bit planes designates the number of colors available.
  99.         1 = Monochrome (1 bit, 2 colors), 2 = Medium Res. (2 bits, 4 colors),
  100.         4 = Low Res. (4 bits, 16 colors)
  101.     3)  The number of bit planes is also important in that an IMG file
  102.         saves ALL the information for the first bit plane before saving the
  103.         information for the second and so on...
  104.     4)  The source pixel width and height are primarily of use for
  105.         determining the aspect ratio of an image. (Personal opinion.)
  106.         The 'work_out[]' array used by GEM returns the pixel width and
  107.         height for a specified device from the function, v_opnwk() in
  108.         words 3 and 4.  In the case of the screen, I don't believe these
  109.         values are accurate for size, but they do properly indicate the
  110.         proper aspect ratio.  The ST monochrome screen "device" will return
  111.         the value 372 in both word 3 and 4, indicating a 1:1 aspect ratio.
  112.     5)  Atari markets a product in europe called, HyperPaint, that can
  113.         edit and save IMG images.  It extends the header by 17 words to
  114.         hold the current palette.  (Or so I'm told.)  Unfortunately,
  115.         there is no predefined way to tell WHAT extra information may be
  116.         stored in an IMG file.  It is up to the program that created the
  117.         file and therefore, extra information is often of little use.
  118.         Other programs using the IMG format store the palette in separate
  119.         files.
  120.  
  121. The Bit-Map
  122. === === ===
  123.  
  124.     IMG files are saved a scan-line at a time using one of three methods.
  125. (REMEMBER: All the scan lines for bit plane 0 are stored, followed by
  126. bit plane 1 and so on.)  The 3 methods are BIT STRING, PATTERN RUN and
  127. SOLID RUN.
  128.  
  129.     BIT STRING:
  130.     === ======
  131.  
  132.         This is the one I use, it's the easiest.  (It's also the least
  133.         efficient since it incorporates NO compression.)
  134.  
  135.     Byte 0    :     0x80    -   Specifies that the scan-line will be
  136.                                 saved as a bit string.
  137.     Byte 1    :     0-255   -   Byte count, n. (Number of bytes per
  138.                                 scan-line.)
  139.     Byte 2 - n:             -   A scan-line's worth of raw data for the
  140.                                 bit plane being saved.
  141.  
  142.     SOLID RUN:
  143.     ===== ===
  144.  
  145.         A solid run means that ALL the bits in the scan-line are either
  146.     on or off.  It is specified by a single byte whose high-order bit is
  147.     set to indicate ON or OFF.  The lower seven bits specify the number of
  148.     bytes making up the scan-line with all their bits set or cleared.
  149.     Thus, up to 127 bytes can make up a scan-line using this method.
  150.  
  151.     Byte = 0x03 = 00000011
  152.  
  153.     Results in a scan-line of 3 bytes with NO bits set.
  154.  
  155.         00000000 00000000 00000000
  156.  
  157.     PATTERN RUN:
  158.     ======= ===
  159.  
  160.         A pattern run is a number of 'pattern bytes' repeated a specified
  161.     number of times.  The number of bytes making up a pattern is specified
  162.     in word 3 of the header.  (Usually 2.)
  163.  
  164.     There are 2 bytes + the pattern bytes in a pattern run.
  165.  
  166.     Byte 0      :   0x00    -   Specifies a pattern run.  (Mostly)
  167.     Byte 1      :   1-255   -   Number of bytes in run.
  168.                                 (bytes per scan-line)
  169.     Byte 2 - n  :           -   Pattern to be repeated.
  170.  
  171.  
  172.     *REPLICATION COUNT:
  173.      =========== =====
  174.  
  175.         A scan-lines worth of data can be repeated up to 255 times by
  176.     preceeding any one of the 3 previous methods with a replication
  177.     count.  A replication count consists of 4 bytes.
  178.  
  179.     Byte 0      :   0x00    -   (A sort-of large pattern run.)
  180.     Byte 1      :   0x00    -   To avoid confusion with a pattern run.
  181.     Byte 2      :   0xFF    -   ??? (I don't know why.)
  182.     Byte 3      :   0-255   -   Number of times to repeat scan-line data.
  183.  
  184. Comments:
  185. ========
  186.  
  187.     Other than the REPLICATION COUNT, I don't see why the requirement to
  188. save an entire line using the same method.  This information was extracted
  189. from 2 articles appearing in recent british ST magazines.
  190.  
  191.         June 1989 Atari ST User :   Page 117
  192.         July 1989 ST World (UK) :   Page 48
  193.  
  194.     If you are interested in the IMG format, try to get either or both
  195. of these magazines.  The first discusses IMG relative to the program
  196. listing in the article, but is still rather complete.  The second is
  197. entirely oriented to describing the IMG format.
  198.  
  199.     I guess it wasn't so short after all.  Let me know any features you
  200. would like to see added to the program.
  201.  
  202. -Craig W. Daymon
  203.  
  204.